/**
 * @author swiip
 * Describes the First Graphical Component
 */
 
$C.Extend(["Archetype.component.graphicalComponent"], {
	name:"BasicSample.firstGraphicalComponent",
	/**
	 * Set up the Component dependencies
	 * The component won't launch main() unless
	 * every dependencies in the setup are available
	 */
	setup:{
		dependencies: {
			components:{},
			lib:[Archetype.i18n("i18n.{lang}")],
			css:["BasicSample.firstGraphicalComponent"],
			html:{main: "BasicSample.firstGraphicalComponentTal"}
		},
        template: "Archetype.template.talTemplate"
	},
	/**
	 * Start the Component itself
	 */
	initialize: function() {
		this.fireHelloFirstGraphicalComponent("Hello, World!");
		Logger.log("First component loaded !!");
		
        this.foobar = ["foo", "bar"];
		this.render($(document.body));
		
		Logger.debug("First component rendered !!");
		//tests for this binding
		setTimeout(this.privateTest,1000);
		this.privateTest.bind(window)();
		
		this.observe(document.body, "click", this.fireHelloWorld);
		
	},
	observe: _,
	fireHelloWorld: _,
	onHelloWorld: function() {
		Logger.debug("Hello World !");
	},
	_privateTest:function() {
		//Logger.warn("test:",this);
		//Logger.warn(this.testStr);
		//Logger.warn(this.testNbr);	
	},
	/**
	 * Is called when any HelloFirstGraphicalComponent is fired
	 * @param {String} name : event name
	 * @param {Object} data : event data 
	 */
	onHelloFirstGraphicalComponent: function(name, data) {
		Logger.warn(this.testStr);
		Logger.warn(this.testNbr);	
		Logger.warn("event "+name+" called. Data: ",data);
	},
	/**
	 * Call this function to fire a HelloFirstGraphicalComponent
	 * The original function is not used for the moment
	 */
	fireHelloFirstGraphicalComponent: function(){
		Logger.warn("Cette fonction ne sera pas appelee!")
	}
});